Skip to content

fix: correctly cache mesh collision objects - #49

Closed
LoayAhmed304 wants to merge 8 commits into
feat/shootingfrom
fix/models-caching
Closed

fix: correctly cache mesh collision objects#49
LoayAhmed304 wants to merge 8 commits into
feat/shootingfrom
fix/models-caching

Conversation

@LoayAhmed304

@LoayAhmed304 LoayAhmed304 commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

This prevents the current game crashing on reusing collision shapes for enemies

  • Remove the collider bulletMesh component data member, since it gets destroyed from one collider but still gets used by another, so it's pretty useless since we're implementing caching.
  • Add new shapeCacheId for colliders to store the cache id for the model/mesh when loaded. This isn't deserialized, but instead is set by the enemy spawned when creating an enemy.
  • Add new meshDataCache for the collision system to store meshes collision objects.
  • Re-order the collision update call to be before any raycast calls

Future work

  • We should not use btBvhTriangleMeshShape for dynamic objects (enemies), it's optimized for static environments. Instead, we should use btGImpactMeshShape.

@AhmedSobhy01

Copy link
Copy Markdown
Collaborator

Cherry-picked the two commits to #47, closing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants